import { postService, postServiceList } from '.'
import { PORT1 } from '../config/net.config'
import { Inventory } from './interface/goods'

// 获取商品分类列表
export const getWaresCategoryListAPI = (params: {}) => {
  return postService<Array<Inventory.CategoryList>>(`${PORT1}/CoreCmsGoodsCategory/GetPageList`, params, 'form')
}
export const createWaresCategoryList = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsGoodsCategory/DoCreate`, params, 'json')
}
export const editWaresCategoryList = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsGoodsCategory/DoEdit`, params)
}
export const deleteWaresCategoryList = (params: {}) => {
  return postService<null>(`${PORT1}/CoreCmsGoodsCategory/DoBatchDelete`, params)
}

export const getGoodsList = (params: any) => {
  return postServiceList<Inventory.ResGoodsList>(`${PORT1}/CoreCmsGoods/GetGoodProcuctPageList`, params, false)
}
export const deleteGoodsAPI = (params: any) => {
  return postService<null>(`${PORT1}/CoreCmsGoods/DoDelete`, params, 'json')
}
export const addGoodsAPI = (params: Inventory.GoodsDetail) => {
  return postService<null>(`${PORT1}/CoreCmsGoods/DoCreate`, params, 'json')
}

// 获取商品详细
export const getGoodsDetailAPI = (params: any) => {
  return postService<Inventory.GoodsDetail>(`${PORT1}/CoreCmsGoods/GetEdit`, params, 'json')
}

// 编辑商品

export const editGoodsAPI = (params: Inventory.GoodsDetail) => {
  return postService<null>(`${PORT1}/CoreCmsGoods/DoEdit`, params, 'json')
}

// 获取品牌列表
export const getBranchAPI = (params: {}) => {
  return postServiceList<Inventory.BranchList>(`${PORT1}/corecmsbrand/GetPageList`, params, false)
}
// 获取供应商列表
export const getSupplierAPI = (params: {}) => {
  return postServiceList<Inventory.SupplierList>(`${PORT1}/CoreCmsSupplier/GetPageList`, params, false)
}
